<template>
  <div>
    <el-button size="mini" type="primary" icon="el-icon-edit" @click="to"/>
    <eForm ref="form" :sup_this="sup_this" :is-add="false" :eqpt-id="eqptId"/>
  </div>
</template>
<script>
import eForm from './form'
export default {
  components: { eForm },
  props: {
    data: {
      type: Object,
      required: true
    },
    sup_this: {
      type: Object,
      required: true
    },
    eqptId: {
      type: Number,
    }
  },
  methods: {
    to() {
      const _this = this.$refs.form
      _this.getSpareparttmodel()
      _this.getSparepartBrand()
      _this.form = {
        id: this.data.id,
        spareno: this.data.spareno,
        sparepartname: this.data.sparepartname,
        typename: this.data.typename,
        sparepartbrand: this.data.sparepartbrand,
        spareparttmodel: this.data.spareparttmodel,
        serialno: this.data.serialno,
        sparebelong: this.data.sparebelong,
        warehouse: this.data.warehouse,
        supplier: this.data.supplier,
        stock_by: this.data.stock_by,
        stock_time: new Date(this.data.stock_time),
      }
      _this.dialog = true
    }
  }
}
</script>

<style scoped>
  div{
    display: inline-block;
    margin-right: 3px;
  }
</style>
